package com.fitness.front.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fitness.front.modal.course.entity.CoursePlan;
import com.fitness.front.modal.course.params.CoursePlanPageQueryParams;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface CoursePlanMapper extends BaseMapper<CoursePlan> {

    @Select("<script>select * from t_course_plan c "
            + " <where>"
            + "<if test='queryParams.keywords != null and queryParams.keywords.trim() neq \"\"'>"
            + " AND c.name like  CONCAT('%',#{queryParams.keyword},'%')"
            + "</if>"
            + "</where>"
            +"</script>")
    Page<CoursePlan> getCoursePlanPage(Page<CoursePlan> page, @Param("queryParams") CoursePlanPageQueryParams queryParams);

    void insertBatchSomeColumn(List<CoursePlan> coursePlans);

}
